<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Area extends Model
{
    protected $table = 'dd_area';
    protected $primaryKey = 'id';
    public $timestamps = false;
    protected $guarded = array();
    
    public static function addArea(\Illuminate\Http\Request $request) {
        $data = $request->all();
        $data['ctime'] = time();
        $res = static::create($data);
        if ($res) {
            return \Illuminate\Support\Facades\Response::json([
                'status'    => 1,
                'info'      => '添加成功'
            ]);
        } else {
            return \Illuminate\Support\Facades\Response::json([
                'status'    => 0,
                'info'      => '添加失败'
            ]);
        }
    }
    
    /**
     * 添加时间
     */
    public function strTime() {
       return date("Y-m-d", $this->ctime);
    }
}
